﻿@using OBUCare.Web.Infrastructure;
@using OBUCare.Core.Models;
@using OBUCare.Core.BL;
@using OBUCare.Core.DataAccess;
@using OBUCare.Core.Common
@model object

@{

    Layout = "";
}

<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />

<div id="divPrint">

    <h2 style="text-align: center; height: 60px;">元器件划拨登记</h2>

    <table style="width: 100%;">
        <tr>
            <td style="width: 10%; text-align:center;">源营业厅：
            </td>
            <td style="width: 23%">
                <label id="lblsAgent">@ViewBag.fromAgent</label>
            </td>
            <td style="width: 10%; text-align:center;">目的营业厅：
            </td>
            <td style="width: 23%">
                <label id="lbltAgent">@ViewBag.toAgent</label>
            </td>

            <td style="width: 10%; text-align:center;">日期：
            </td>
            <td style="width: 23%">
                @DateTime.Now.ToString(UIConstants.DateFormatString)
            </td>
        </tr>
        <tr style="height: 20px;">
            <td colspan="3"></td>

        </tr>
    </table>
    
    <div>



    @(Html.Telerik().Grid<View_Parts_Transfer>()
            .Name("pGrid")
            .DataKeys(keys => keys.Add(c => c.ID))
            //.Sortable(sorting => sorting.SortMode(GridSortMode.SingleColumn))
            .Resizable(resizing => resizing.Columns(true))
            .DataBinding(dataBinding => dataBinding.Ajax()
                .Select("ListPartsTransfer", "Parts", new { searchSql=Model.ToText()})
                )
            .Columns(columns =>
            {
                columns.Bound(o => o.ID)
                .ClientTemplate("<#= ++index #>").Title("序号").Width("15%");
                columns.Bound(o => o.PARTS_NAME).Width("15%");
                columns.Bound(o => o.SUPPLIER_NAME).Width("15%");
                columns.Bound(o => o.SPEC_NAME).Width("15%");
                columns.Bound(o => o.PARTS_COUNT).Width("20%");
                columns.Bound(o => o.REMARK).Width("20%");
            }).TableHtmlAttributes(new { style = "width:100%" })
            //.Scrollable(scroll => scroll.Height(CommonStyleForUI.Grid_Height))
                                   .Footer(false)
                                           .ClientEvents(events =>
                        {
                            events.OnError("onError");
                            events.OnDataBinding("onDataBinding");
                        })
                            )


        </div>
    
    <table style="width:100%">

        <tr style="height: 10px;">
            <td colspan="3"></td>
        </tr>
    <tr style="height: 35px;">
        <td style="width:25%;text-align:right;">
            交接人：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </td>
        <td style="width:25%">
        </td>
        <td style="width:25%; text-align:right;">
            日期：
        </td>
        <td style="width:25%">
        </td>
    </tr>
    <tr style="height: 35px;">
        <td style="text-align:right;">
            配送人：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </td>
        <td>
        </td>
        <td style="text-align:right;">
            日期：
        </td>
        <td>
        </td>
    </tr>
    <tr style="height: 35px;">
        <td style="text-align:right;">
            接收人：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </td>
        <td>
        </td>
        <td style="text-align:right;">
            日期：
        </td>
        <td>
        </td>
    </tr>
</table>


</div>

<div style="text-align: right;" id="noPrint">
    <p>
        <input type="button" onclick="myPrint();" value="打印" />
        <input type="button" onclick="CloseWindow();" value="关闭" />
    </p>
</div>


<script type="text/javascript">

    function onError(e) {
        //debugger;
        e.preventDefault();
        /*if (e.XMLHttpRequest.status == "505")
        alert("系统字段不允许删除");
        else if (e.XMLHttpRequest.status == "506")
        alert("系统表不允许删除");
        else*/
        alert(e.XMLHttpRequest.getResponseHeader("message"));
    }

    var index = 0;

    function onDataBinding(e) {
        //debugger;
        /*var grid = $('#pGrid').data('tGrid')
        index = (grid.currentPage - 1) * grid.pageSize;
        var sSql = $('#hidSql').val();
        if (sSql.StringIsNullOrEmpty())
            e.preventDefault();
        else {
            e.data = {
                // the key ("category") specifies the variable name of the action method which will contain the specified value
                searchSql: sSql
            };
        }*/
    }

    function myPrint()
    {
        $("#noPrint").css("display", "none");
        window.print();
        $("#noPrint").css("display", "");
    }

    
</script>

@Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/Common")
    @(Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.simple.css").Combined(true).Compress(true)))
    @(Html.Telerik().ScriptRegistrar().Globalization(true).DefaultGroup(group => group.Combined(true).Compress(true)))


